package com.wc.alorithm_blue_bridge._二分.区间移位;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

/**
 * @Author congge
 * @Date 2025/5/21 20:20
 * @description https://www.lanqiao.cn/problems/111/learning/?page=1&first_category_id=1&tags=%E4%BA%8C%E5%88%86&tag_relation=union
 */
public class Main {
    /**
     * 思路：
     * 二分枚举答案，
     * 右边界排序
     */
    static FastReader sc = new FastReader();
    static PrintWriter out = new PrintWriter(System.out);
    static int N = 10010;
    static double eps = 1e-6;
    static int[][] a = new int[N][2];
    static boolean[] st = new boolean[N];
    static int n;

    public static void main(String[] args) {
        n = sc.nextInt();
        for (int i = 1; i <= n; i++) {
            a[i][0] = sc.nextInt() * 2;
            a[i][1] = sc.nextInt() * 2;
        }
        Arrays.sort(a, 1, n + 1, (o1, o2) -> {
            if (o1[1] == o2[1]) return o1[0] - o2[0];
            return o1[1] - o2[1];
        });

        int l = 0, r = 20000;
        while (l < r) {
            int mid = l + r >> 1;
            if (check(mid)) r = mid;
            else l = mid + 1;
        }

        if (r % 2 == 0) out.println(r / 2);
        else out.println(r * 1.0 / 2);
        out.flush();
    }

    static boolean check(int x) {
        int R = 0;
        Arrays.fill(st, 1, n + 1, false);

        while (true) {
            boolean flg = false;
            for (int i = 1; i <= n; i++) {
                if (st[i]) continue;
                int l = a[i][0], r = a[i][1];
                if (l > R) {
                    if (l - R > x) continue;
                    R = Math.max(R, r - (l - R));
                } else R = Math.max(R, r + Math.min(x, R - l));
                st[i] = true;
                flg = true;
            }
            if (!flg) break;
        }

        return R >= 20000;
    }

}

class FastReader {
    StringTokenizer st;
    BufferedReader br;

    FastReader() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    String nextLine() {
        String s = "";
        try {
            s = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return s;
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    double nextDouble() {
        return Double.parseDouble(next());
    }

    // 是否由下一个
    boolean hasNext() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                String line = br.readLine();
                if (line == null)
                    return false;
                st = new StringTokenizer(line);
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return true;
    }
}

